//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>
package org.jpgolay.wi.user;

import java.io.Serializable;
import java.math.BigDecimal;

public class User
        implements Serializable {

    public User() {
    }

    public User(Integer id, String pass, String lastname, String firstname, String addrLn1, String addrLn2, String city,
            String county, String zip, String tel1, String tel2, String fax, String email, String web,
            Integer agencyId, Integer access, Integer groupId, String smtp, String expiryDate, BigDecimal paymentDue, String comment,
            String lastUpdate, String lastUser, byte logo[]) {
        setId(id);
        setPass(pass);
        setLastname(lastname);
        setFirstname(firstname);
        setAddrLn1(addrLn1);
        setAddrLn2(addrLn2);
        setCity(city);
        setCounty(county);
        setZip(zip);
        setTel1(tel1);
        setTel2(tel2);
        setFax(fax);
        setEmail(email);
        setWeb(web);
        setAgencyId(agencyId);
        setAccess(access);
        setGroupId(groupId);
        setUsername(smtp);
        setExpiryDate(expiryDate);
        setPaymentDue(paymentDue);
        setComment(comment);
        setLastUpdate(lastUpdate);
        setLastUser(lastUser);
        setLogo(logo);
    }

    public User(User otherData) {
        setId(otherData.getId());
        setPass(otherData.getPass());
        setLastname(otherData.getLastname());
        setFirstname(otherData.getFirstname());
        setAddrLn1(otherData.getAddrLn1());
        setAddrLn2(otherData.getAddrLn2());
        setCity(otherData.getCity());
        setCounty(otherData.getCounty());
        setZip(otherData.getZip());
        setTel1(otherData.getTel1());
        setTel2(otherData.getTel2());
        setFax(otherData.getFax());
        setEmail(otherData.getEmail());
        setWeb(otherData.getWeb());
        setAgencyId(otherData.getAgencyId());
        setAccess(otherData.getAccess());
        setGroupId(otherData.getGroupId());
        setUsername(otherData.getUsername());
        setExpiryDate(otherData.getExpiryDate());
        setPaymentDue(otherData.getPaymentDue());
        setComment(otherData.getComment());
        setLastUpdate(otherData.getLastUpdate());
        setLastUser(otherData.getLastUser());
        setLogo(otherData.getLogo());
    }

    public Integer getPrimaryKey() {
        return getId();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getPass() {
        return pass;
    }

    public void setPass(String pass) {
        this.pass = pass;
    }

    public String getLastname() {
        return lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public String getAddrLn1() {
        return addrLn1;
    }

    public void setAddrLn1(String addrLn1) {
        this.addrLn1 = addrLn1;
    }

    public String getAddrLn2() {
        return addrLn2;
    }

    public void setAddrLn2(String addrLn2) {
        this.addrLn2 = addrLn2;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getCounty() {
        return county;
    }

    public void setCounty(String county) {
        this.county = county;
    }

    public String getZip() {
        return zip;
    }

    public void setZip(String zip) {
        this.zip = zip;
    }

    public String getTel1() {
        return tel1;
    }

    public void setTel1(String tel1) {
        this.tel1 = tel1;
    }

    public String getTel2() {
        return tel2;
    }

    public void setTel2(String tel2) {
        this.tel2 = tel2;
    }

    public String getFax() {
        return fax;
    }

    public void setFax(String fax) {
        this.fax = fax;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getWeb() {
        return web;
    }

    public void setWeb(String web) {
        this.web = web;
    }

    public Integer getAgencyId() {
        return agencyId;
    }

    public void setAgencyId(Integer agencyId) {
        this.agencyId = agencyId;
    }

    public Integer getAccess() {
        return access;
    }

    public void setAccess(Integer access) {
        this.access = access;
    }

    public Integer getGroupId() {
        return groupId;
    }

    public void setGroupId(Integer groupId) {
        this.groupId = groupId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getExpiryDate() {
        return expiryDate;
    }

    public void setExpiryDate(String expiryDate) {
        this.expiryDate = expiryDate;
    }

    public BigDecimal getPaymentDue() {
        return paymentDue;
    }

    public void setPaymentDue(BigDecimal paymentDue) {
        this.paymentDue = paymentDue;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public byte[] getLogo() {
        return logo;
    }

    public void setLogo(byte logo[]) {
        this.logo = logo;
    }

    public String getLastUpdate() {
        return lastUpdate;
    }

    public String getLastUser() {
        return lastUser;
    }

    public void setLastUpdate(String string) {
        lastUpdate = string;
    }

    public void setLastUser(String string) {
        lastUser = string;
    }

    public String toString() {
        StringBuffer str = new StringBuffer("{");
        str.append("id=" + getId() + " " + "pass=" + getPass() + " " + "lastname=" + getLastname() + " " + "firstname=" + getFirstname() + " " + "addrLn1=" + getAddrLn1() + " " + "addrLn2=" + getAddrLn2() + " " + "city=" + getCity() + " " + "county=" + getCounty() + " " + "zip=" + getZip() + " " + "tel1=" + getTel1() + " " + "tel2=" + getTel2() + " " + "fax=" + getFax() + " " + "email=" + getEmail() + " " + "web=" + getWeb() + " " + "agencyId=" + getAgencyId() + " " + "access=" + getAccess() + " " + "groupId=" + getGroupId() + " " + "username=" + getUsername() + " " + "expiryDate=" + getExpiryDate() + " " + "paymentDue=" + getPaymentDue() + " " + "comment=" + getComment() + " " + "lastUpdate=" + getLastUpdate() + " " + "lastUser=" + getLastUser() + " " + "logo=" + getLogo());
        str.append('}');
        return str.toString();
    }

    public boolean equals(Object pOther) {
        if (pOther instanceof User) {
            User lTest = (User) pOther;
            boolean lEquals = true;
            if (id == null) {
                lEquals = lEquals && lTest.id == null;
            } else {
                lEquals = lEquals && id.equals(lTest.id);
            }
            if (pass == null) {
                lEquals = lEquals && lTest.pass == null;
            } else {
                lEquals = lEquals && pass.equals(lTest.pass);
            }
            if (lastname == null) {
                lEquals = lEquals && lTest.lastname == null;
            } else {
                lEquals = lEquals && lastname.equals(lTest.lastname);
            }
            if (firstname == null) {
                lEquals = lEquals && lTest.firstname == null;
            } else {
                lEquals = lEquals && firstname.equals(lTest.firstname);
            }
            if (addrLn1 == null) {
                lEquals = lEquals && lTest.addrLn1 == null;
            } else {
                lEquals = lEquals && addrLn1.equals(lTest.addrLn1);
            }
            if (addrLn2 == null) {
                lEquals = lEquals && lTest.addrLn2 == null;
            } else {
                lEquals = lEquals && addrLn2.equals(lTest.addrLn2);
            }
            if (city == null) {
                lEquals = lEquals && lTest.city == null;
            } else {
                lEquals = lEquals && city.equals(lTest.city);
            }
            if (county == null) {
                lEquals = lEquals && lTest.county == null;
            } else {
                lEquals = lEquals && county.equals(lTest.county);
            }
            if (zip == null) {
                lEquals = lEquals && lTest.zip == null;
            } else {
                lEquals = lEquals && zip.equals(lTest.zip);
            }
            if (tel1 == null) {
                lEquals = lEquals && lTest.tel1 == null;
            } else {
                lEquals = lEquals && tel1.equals(lTest.tel1);
            }
            if (tel2 == null) {
                lEquals = lEquals && lTest.tel2 == null;
            } else {
                lEquals = lEquals && tel2.equals(lTest.tel2);
            }
            if (fax == null) {
                lEquals = lEquals && lTest.fax == null;
            } else {
                lEquals = lEquals && fax.equals(lTest.fax);
            }
            if (email == null) {
                lEquals = lEquals && lTest.email == null;
            } else {
                lEquals = lEquals && email.equals(lTest.email);
            }
            if (web == null) {
                lEquals = lEquals && lTest.web == null;
            } else {
                lEquals = lEquals && web.equals(lTest.web);
            }
            if (agencyId == null) {
                lEquals = lEquals && lTest.agencyId == null;
            } else {
                lEquals = lEquals && agencyId.equals(lTest.agencyId);
            }
            if (access == null) {
                lEquals = lEquals && lTest.access == null;
            } else {
                lEquals = lEquals && access.equals(lTest.access);
            }
            if (groupId == null) {
                lEquals = lEquals && lTest.groupId == null;
            } else {
                lEquals = lEquals && groupId.equals(lTest.groupId);
            }
            if (username == null) {
                lEquals = lEquals && lTest.username == null;
            } else {
                lEquals = lEquals && username.equals(lTest.username);
            }
            if (expiryDate == null) {
                lEquals = lEquals && lTest.expiryDate == null;
            } else {
                lEquals = lEquals && expiryDate.equals(lTest.expiryDate);
            }
            if (paymentDue == null) {
                lEquals = lEquals && lTest.paymentDue == null;
            } else {
                lEquals = lEquals && paymentDue.equals(lTest.paymentDue);
            }
            if (comment == null) {
                lEquals = lEquals && lTest.comment == null;
            } else {
                lEquals = lEquals && comment.equals(lTest.comment);
            }
            if (lastUpdate == null) {
                lEquals = lEquals && lTest.lastUpdate == null;
            } else {
                lEquals = lEquals && lastUpdate.equals(lTest.lastUpdate);
            }
            if (lastUser == null) {
                lEquals = lEquals && lTest.lastUser == null;
            } else {
                lEquals = lEquals && lastUser.equals(lTest.lastUser);
            }
            if (logo == null) {
                lEquals = lEquals && lTest.logo == null;
            } else {
                lEquals = lEquals && logo.equals(lTest.logo);
            }
            return lEquals;
        } else {
            return false;
        }
    }

    public int hashCode() {
        int result = 17;
        result = 37 * result + (id == null ? 0 : id.hashCode());
        result = 37 * result + (pass == null ? 0 : pass.hashCode());
        result = 37 * result + (lastname == null ? 0 : lastname.hashCode());
        result = 37 * result + (firstname == null ? 0 : firstname.hashCode());
        result = 37 * result + (addrLn1 == null ? 0 : addrLn1.hashCode());
        result = 37 * result + (addrLn2 == null ? 0 : addrLn2.hashCode());
        result = 37 * result + (city == null ? 0 : city.hashCode());
        result = 37 * result + (county == null ? 0 : county.hashCode());
        result = 37 * result + (zip == null ? 0 : zip.hashCode());
        result = 37 * result + (tel1 == null ? 0 : tel1.hashCode());
        result = 37 * result + (tel2 == null ? 0 : tel2.hashCode());
        result = 37 * result + (fax == null ? 0 : fax.hashCode());
        result = 37 * result + (email == null ? 0 : email.hashCode());
        result = 37 * result + (web == null ? 0 : web.hashCode());
        result = 37 * result + (agencyId == null ? 0 : agencyId.hashCode());
        result = 37 * result + (access == null ? 0 : access.hashCode());
        result = 37 * result + (groupId == null ? 0 : groupId.hashCode());
        result = 37 * result + (username == null ? 0 : username.hashCode());
        result = 37 * result + (expiryDate == null ? 0 : expiryDate.hashCode());
        result = 37 * result + (paymentDue == null ? 0 : paymentDue.hashCode());
        result = 37 * result + (comment == null ? 0 : comment.hashCode());
        result = 37 * result + (lastUpdate == null ? 0 : lastUpdate.hashCode());
        result = 37 * result + (lastUser == null ? 0 : lastUser.hashCode());
        result = 37 * result + (logo == null ? 0 : logo.hashCode());
        return result;
    }
    private Integer id;
    private Integer groupId;
    private String username;
    private String pass;
    private String lastname;
    private String firstname;
    private String addrLn1;
    private String addrLn2;
    private String city;
    private String county;
    private String zip;
    private String tel1;
    private String tel2;
    private String fax;
    private String email;
    private String web;
    private Integer agencyId;
    private Integer access;
    private String expiryDate;
    private BigDecimal paymentDue;
    private String comment;
    private byte logo[];
    private String lastUpdate;
    private String lastUser;
}
